import { request } from "@/utils/service"
import { PageData } from "types/pageData"
import { Dictionary } from "./types/dictionary"
import { DictionaryQuery } from "./types/dictionaryQuery"
export function getLazyList(query: DictionaryQuery) {
  return request<ApiResponseData<PageData<Dictionary>>>({
    url: "/api/dictionary/GetLazyNode",
    method: "get",
    params: query
  })
}

export function create(data: Dictionary) {
  return request<ApiResponseData<boolean>>({
    url: "/api/dictionary/CreateNode",
    method: "post",
    data: data
  })
}

export function update(data: Dictionary) {
  return request<ApiResponseData<boolean>>({
    url: "/api/dictionary/UpdateNode",
    method: "post",
    data: data
  })
}

export function del(params: any) {
  return request<ApiResponseData<boolean>>({
    url: "/api/dictionary/DeleteNode",
    method: "get",
    params: params
  })
}

export function getTreeList() {
  return request<ApiResponseData<Dictionary[]>>({
    url: "/api/dictionary/GetTreeList",
    method: "get"
  })
}

export function getListByParentId(params: any) {
  return request<ApiResponseData<Dictionary[]>>({
    url: "/api/dictionary/GetListByParentId",
    method: "get",
    params: params
  })
}
